#!/usr/bin/env ruby

require "style_stats"
require 'optparse'

options = {}
opt = OptionParser.new
opt.banner = 'Usage: style_stats [options] <file ...>'

opt.on('-h', '--help', 'output usage information') do
  puts opt
  exit
end

opt.on('-V', '--version', 'output the version number') do |v|
  puts StyleStats::VERSION
  exit
end


opt.on('-c', '--config <path>', 'set configurations') { |v| options[:config] = v }
opt.on('-f', '--format <format>', 'set the output format <json|html|md>') { |v| options[:format] = v }
opt.on('-t', '--template <path>', 'set the template path for output format') { |v| options[:template] = v }
opt.on('-n', '--number', 'show only numeral metrics') { |v| options[:number] = v }
opt.on('-m', '--mobile [name]', 'set the mobile user agent') { |v| options[:user_agent] = v || 'ios' }
opt.on('--user-anget <string>', 'set the user agent') { |v| options[:user_agent] = v }

opt.parse!(ARGV)

if ARGV.empty?
  puts opt
else
  StyleStats::CLI.run(ARGV, options)
end
